<template>
  <div class="app">
    <h3>我是App组件</h3>
    <Suspense>
      <!-- 底层有两个插槽 -->
      <template v-slot:default>
        <Child></Child>
      </template>
      <template v-slot:fallback>
        <h2>等一下</h2>
      </template>
    </Suspense>
  </div>
</template>

<script>
//import Child from './components/Child.vue'  静态引入 得Child解析完之后才一起显示
import { defineAsyncComponent } from "vue";
const Child = defineAsyncComponent(() => import("./components/Child"));
//异步引入 动态引入 App先解析完就先展示 如果有很多个嵌套组件  这样引入就不用等其他都解析好了才显示
export default {
  name: "App",
  components: { Child },
};
</script>

<style scoped>
.app {
  background-color: aqua;
  padding: 10px;
}
</style>